﻿using FbHelperWP7NonUi.Settings;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace FbHelperNonUiTests
{
    [TestClass()]
    public class StyleSettingsTest
    {
        [TestMethod()]
        public void FontSizeTest()
        {
            bool wasRaised = false;

            StyleSettings target = new StyleSettings();

            target.FontSize = 1;

            target.StyleChangedEvent += () =>
            {
                wasRaised = true;
            };

            target.FontSize = 2;

            Assert.IsTrue( wasRaised );
            Assert.AreEqual( 2, target.FontSize );

            wasRaised = false;

            target.FontSize = 2;

            Assert.IsFalse( wasRaised );
            Assert.AreEqual( 2, target.FontSize );
        }

        /// <summary>
        ///A test for IsBold
        ///</summary>
        [TestMethod()]
        public void IsBoldTest()
        {
            bool wasRaised = false;

            StyleSettings target = new StyleSettings();

            target.IsBold = false;

            target.StyleChangedEvent += () =>
            {
                wasRaised = true;
            };

            target.IsBold = true;

            Assert.IsTrue( wasRaised );
            Assert.IsTrue( target.IsBold );

            wasRaised = false;

            target.IsBold = true;

            Assert.IsFalse( wasRaised );
            Assert.IsTrue( target.IsBold );
        }

        /// <summary>
        ///A test for IsItalic
        ///</summary>
        [TestMethod()]
        public void IsItalicTest()
        {
            bool wasRaised = false;

            StyleSettings target = new StyleSettings();

            target.IsItalic = false;

            target.StyleChangedEvent += () =>
            {
                wasRaised = true;
            };

            target.IsItalic = true;

            Assert.IsTrue( wasRaised );
            Assert.IsTrue( target.IsItalic );

            wasRaised = false;

            target.IsItalic = true;

            Assert.IsFalse( wasRaised );
            Assert.IsTrue( target.IsItalic );
        }
    }
}
